package com.yanqu.road.dao.impl.servercenter;

import com.yanqu.road.dao.db.DbNameStrategy;
import com.yanqu.road.dao.impl.TempDao;
import com.yanqu.road.entity.servercenter.H5AppletUrl;

import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

/**
 * 包体标识信息
 */
public class H5AppletUrlDaoImpl extends TempDao {

	public List<H5AppletUrl> getH5AppletUrlDaoImpl() {
		ResultSet rs = null;
		CallableStatement call = null;
		String sql = "select * from t_s_applet_h5_url";
		List<H5AppletUrl> urlList = new ArrayList<>();
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				H5AppletUrl data = new H5AppletUrl();
				data.setId(rs.getInt("id"));
				data.setType(rs.getInt("type"));
				data.setUserId(rs.getString("userId"));
				data.setUrl(rs.getString("url"));
				data.setPlatform(rs.getInt("nPlatform"));
				urlList.add(data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return urlList;
	}
}
